package com.weiyuwqj.server.service.account.service.impl;

import com.github.pagehelper.PageHelper;
import com.weiyuwqj.api.common.PageList;
import com.weiyuwqj.api.common.Paginator;
import com.weiyuwqj.api.model.BusAccountBank;
import com.weiyuwqj.api.model.vo.BusAccountBankVo;
import com.weiyuwqj.api.service.BusAccountBankService;
import com.weiyuwqj.server.mapper.BusAccountBankMapper;
import com.weiyuwqj.server.service.base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("accountBankService")
public class BusAccountBankServiceImpl extends BaseServiceImpl<BusAccountBank> implements BusAccountBankService {

    @Autowired
    BusAccountBankMapper busAccountBankMapper;


    @Override
    public PageList getList(Paginator p, Map<String, Object> param) {
        PageHelper.startPage(p.getPageNum(), p.getPageSize());
        List<BusAccountBankVo> list = busAccountBankMapper.getList(param);
        return new PageList(list);
    }

    @Override
    public List<BusAccountBankVo> getList(Map<String, Object> param) {
        return busAccountBankMapper.getList(param);
    }

    @Override
    public BusAccountBankVo getSingle(Map<String, Object> param) {
        return busAccountBankMapper.getSingle(param);
    }

    //根据用户id的id查询银行卡信息
    @Override
    public List<BusAccountBankVo> getBankByUserId(Integer userId) {
        return busAccountBankMapper.getBankByUserId(userId);
    }

    @Override
    public List<BusAccountBankVo> excelList(Map<String, Object> param) {
        return busAccountBankMapper.getList(param);
    }

    @Override
    public Integer updateBankStatus(Map map) {
        return busAccountBankMapper.updateBankStatus(map);
    }

    //根据卡号查询信息
    @Override
    public BusAccountBank getOneByCardNo(String cardNo) {
        return busAccountBankMapper.getOneByCardNo(cardNo);
    }

    @Override
    public BusAccountBank getOneByUserIdAndStatus(Map map) {
        return busAccountBankMapper.getOneByUserIdAndStatus(map);
    }

    @Override
    public BusAccountBank getOneByUserId(Integer userId) {
        return busAccountBankMapper.getOneByUserId(userId);
    }

    /**
     * 更改银行卡
     *
     * @param newCardNo 新卡号
     * @param mobile    预留手机号码
     * @param bankName  银行名称
     * @param userId    用户id
     * @return
     */
    @Override
    public void changeCard(String newCardNo, String mobile, String bankName, Integer userId) {
        //
    }


}
